Skip to content

[POC] implement test_arithmetic.py #22033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 29, 2018
Merged

Conversation

jbrockmendel
Copy link
Member

There are a ton of scattered arithmetic tests for Index/Series/DataFrame that should be testing the same things, but in fact are haphazard. Fixing this given the current structure would entail an enormous about of code duplication.

This PR if a proof of concept for gathering all those tests in one test_arithmetic.py file, parametrizing them, and ensuring that the relevant behavior is identical across arraylike classes.

As Datetime/Timedelta/Period EA come online, the case for de-duplication will be even stronger.

In this form it is really easy to track (via xfails) what behavior needs fixing.

@gfyoung gfyoung added Refactor Internal refactoring of code Testing pandas testing functions or related to the test suite labels Jul 23, 2018
@gfyoung
Copy link
Member

gfyoung commented Jul 23, 2018

@jbrockmendel : So even though this is a POC, you still want to merge this, right?

@jbrockmendel
Copy link
Member Author

If there is consensus about this goal, yes.

@codecov
Copy link

codecov bot commented Jul 24, 2018

Codecov Report

Merging #22033 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #22033      +/-   ##
==========================================
+ Coverage   92.06%   92.06%   +<.01%     
==========================================
  Files         170      170              
  Lines       50705    50720      +15     
==========================================
+ Hits        46680    46695      +15     
  Misses       4025     4025
Flag Coverage Δ
#multiple 90.47% <100%> (ø) ⬆️
#single 42.3% <13.33%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/util/testing.py 85.9% <100%> (+0.21%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0b7a08b...50e05ea. Read the comment docs.

@jbrockmendel
Copy link
Member Author

@jreback related to discussion about test refactoring.

@jorisvandenbossche
Copy link
Member

The idea would be to add the arrays as when they exist?

general idea looks good to me

@jbrockmendel
Copy link
Member Author

The idea would be to add the arrays as when they exist?

Yes. Shorter term the idea is focused on de-duplication and testing cases that aren't currently covered for all the relevant classes.

from pandas import Timedelta


def assert_equal(left, right, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to utils.testing

raise NotImplementedError(type(left))


def box_expected(expected, box_cls):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe put in conftest.py, these are test helper functions that we don't necessarily want to publicly expose

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively, we should put this into _test_decorators (maybe rename though)

@jreback jreback added this to the 0.24.0 milestone Jul 29, 2018
@jreback jreback merged commit d30c4a0 into pandas-dev:master Jul 29, 2018
@jreback
Copy link
Contributor

jreback commented Jul 29, 2018

all for this!

@jbrockmendel jbrockmendel deleted the arith_tests2 branch July 29, 2018 17:12
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactor Internal refactoring of code Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants